<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <!--<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>-->
    <![endif]-->

    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $.post("findwork","",function(date){
                $(date).each(function(){
                    var workType;
                    var status;
                    if(this.workType==1){
                        workType="安装工单";
                    }else if(this.workType==2){
                        workType="滤芯更换工单";
                    }else if(this.workType==3){
                        workType="报修";
                    }else if(this.workType==4){
                        workType="已处理";
                    }
                    if(this.status==1){
                        status="待处理";
                    }else if(this.status==2){
                        status="处理中";
                    }else if(this.status==3){
                        status="已处理";
                    }
                    $("table").append("<tr>"+
                        "<td>"+this.workid+"</td>"+
                        "<td>"+this.slist[0].ulist[0].uname+"</td>"+
                        "<td>"+this.userName+"</td>"+
                        "<td>"+this.userPhone+"</td>"+
                        "<td>"+this.userAddress+"</td>"+
                        "<td>"+workType+"</td>"+
                        "<td>"+status+"</td>"+
                        "<td>"+this.wlist[0].waterName+"</td>"+
                        "<td><a title='删除' href='#' Class='sc'><i class='layui-icon'>&#xe640;</i></a></td>"+
                        "</tr>"
                    );
                });
                //删除
                $(".sc").click(function () {
                    var $tr = $(this).parent().parent();
                    //children()获得子节点的集合，get(0)获得集合中第一个子元素，
                    //textContent获得节点中的文本内容
                    var id = $tr.children().get(0).textContent;
                    $.post("Servletworkdele", {"id": id}, function (data) {
                        if (data > 0) {
                            alert("删除成功");
                            $tr.remove();
                        } else {
                            alert("删除失败");
                        }
                    });
                });
            },"json");
        });

    </script>


</head>

<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">演示</a>
        <a>
          <cite>导航元素</cite></a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <table class="layui-table">
        <thead>
        <tr>
            <th>订单id</th>
            <th>安装员</th>
            <th>用户姓名</th>
            <th>联系电话</th>
            <th>地址</th>
            <th>订单类型</th>
            <th>订单状态</th>
            <th>净水器</th>
            <th >操作</th>
        </tr>
        </thead>
    </table>
</div>

<script>var _hmt = _hmt || []; (function() {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
})();</script>
</body>

</html>